var xmlhttp = new getXMLObject();


function getXMLObject() {
    var xmlHttp = false;
    try {
      xmlHttp = new ActiveXObject("Msxml2.XMLHTTP")  // For Old Microsoft Browsers
    }
    catch (e) {
        try {
            xmlHttp = new ActiveXObject("Microsoft.XMLHTTP")  // For Microsoft IE 6.0+
        }
        catch (e2) {
            xmlHttp = false   // No Browser accepts the XMLHTTP Object then false
        }
   }
   if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
     xmlHttp = new XMLHttpRequest();        //For Mozilla, Opera Browsers
   }
   return xmlHttp;  // Mandatory Statement returning the ajax object created
}
 
function ajaxFunction()
{
  if(xmlhttp)
  {
	var param1 = "table";
    var param2 = "form_item";
    var param3 = "form_owner";
	
	var val1 = document.getElementById(param1).value;
    var val2 = document.getElementById(param2).value;
    var val3 = document.getElementById(param3).value;
    var reqString = param1 + "=" + val1 + "&" + param2 + "=" + val2 + "&" + param3 + "=" + val3;
    var url = "http://localhost:8080/HI%20Resource%20Catalog/servlet/editItemInDB?" + reqString;
	
    xmlhttp.open("POST", url, true);
	xmlhttp.onreadystatechange = flag();
	
	xmlhttp.send();
	
  }
}
  function flag()
  {
	  alert(xmlhttp.readyState)
	  if (xmlhttp.readyState == 4) 
      {
          if(xmlhttp.status == 200) 
	      {
           alert("It's done");
		  }
      }
  }

